//
//  LGOrderSectionCell.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/7/23.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "LGOrderSectionCell.h"
#import "OrderListModel.h"
@interface LGOrderSectionCell()
@property (weak, nonatomic) IBOutlet UILabel *orderNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *orderStateLabel;

@end
@implementation LGOrderSectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setupOrderData:(id)data withType:(ViewSectionType) type{
    OrderModel * model = data;
    //订单状态 0-待付款 10-待发货 20-待收货 30-待评价 40-已完成 50-退款中 51-退款被拒绝 60 -退款成功 90-已取消
   
    self.orderStateLabel.text = [self getTitleState:model withViewSectionType:type];
    NSString * titleStr = @"";
    if (type == ViewSectionType_AllOrders) {
        titleStr = @"订单编号";
    }
    else if (type == ViewSectionType_Identification) {
        titleStr = @"鉴定编号";
    }
    else  if (type == ViewSectionType_maintenance) {
        titleStr = @"养护编号";
    }
    else  if (type == ViewSectionType_Con) {
        titleStr = @"寄卖编号";
    }
    else  if (type == ViewSectionType_Re) {
        titleStr = @"回收编号";
    }
    self.orderNumberLabel.text = [NSString stringWithFormat:@"%@: %@",titleStr,model.order_no];
    
}

- (NSString *)getTitleState:(OrderModel *)model withViewSectionType:(ViewSectionType ) type{
    
    NSString * stateStr = @"";
    switch ([model.status integerValue]) {
        case 0:
            if (type == ViewSectionType_Con || type == ViewSectionType_Re) {
                stateStr = @"待报价";
            }else
                stateStr = @"待付款";
            break;
        case 10:
            if (type == ViewSectionType_Con || type == ViewSectionType_Re) {
                stateStr = @"已报价";
            }else
                stateStr = @"待发货";
            break;
        case 20:
            if (type == ViewSectionType_Con || type == ViewSectionType_Re) {
                stateStr = @"已寄件";
            }else
                stateStr = @"待收货";
            break;
        case 30:
            if (type == ViewSectionType_Con || type == ViewSectionType_Re) {
                stateStr = @"出售中";
            }else
                stateStr = @"待评价";
            break;
        case 40:
            stateStr = @"已完成";
            break;
        case 50:
            stateStr = @"退款中";
            break;
        case 51:
            stateStr = @"退款被拒绝";
            break;
        case 60:
            stateStr = @"退款成功";
            break;
        case 90:
            stateStr = @"取消";
            break;
        default:
            break;
    }
    
    return stateStr;
}
@end
